package com.ruoyi.shop.member.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shop.member.mapper.ShopMemberAuthMapper;
import com.ruoyi.shop.member.domain.ShopMemberAuth;
import com.ruoyi.shop.member.service.IShopMemberAuthService;

/**
 * 会员用户三方授权认证Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-11-16
 */
@Service
public class ShopMemberAuthServiceImpl implements IShopMemberAuthService {
	@Autowired
	private ShopMemberAuthMapper shopMemberAuthMapper;

	/**
	 * 查询会员用户三方授权认证
	 * 
	 * @param uniqueId 单端唯一标识
	 * @return
	 */
	@Override
	public ShopMemberAuth selectByUniqueId(String uniqueId) {
		return shopMemberAuthMapper.selectByUniqueId(uniqueId);
	}

	/**
	 * 查询会员用户三方授权认证
	 * 
	 * @param unionId 多端唯一标识
	 * @return
	 */
	@Override
	public ShopMemberAuth selectByUnionId(String unionId) {
		return shopMemberAuthMapper.selectByUnionId(unionId);
	}

	/**
	 * 查询会员用户三方授权认证
	 * 
	 * @param uniqueId 单端唯一标识
	 * @param unionId  多端唯一标识
	 * @return
	 */
	@Override
	public ShopMemberAuth selectByUniqueIdOrUnionId(String uniqueId, String unionId) {
		return shopMemberAuthMapper.selectByUniqueIdOrUnionId(uniqueId, unionId);

	}
	
	/**
	 * 根据会员id查询UniqueId
	 * 
	 * @param memberId
	 * @param clientType
	 * @return
	 */
	@Override
	public String selectUniqueIdByMemberId(Long memberId, String clientType) {
		return shopMemberAuthMapper.selectUniqueIdByMemberId(memberId, clientType);
	}

	/**
	 * 新增会员用户三方授权认证
	 * 
	 * @param shopMemberAuth 会员用户三方授权认证
	 * @return 结果
	 */
	@Override
	public int insertMemberAuth(ShopMemberAuth shopMemberAuth) {
		return shopMemberAuthMapper.insertMemberAuth(shopMemberAuth);
	}

	/**
	 * 修改会员用户三方授权认证
	 * 
	 * @param shopMemberAuth 会员用户三方授权认证
	 * @return 结果
	 */
	@Override
	public int updateMemberAuth(ShopMemberAuth shopMemberAuth) {
		shopMemberAuth.setUpdateTime(DateUtils.getNowDate());
		return shopMemberAuthMapper.updateMemberAuth(shopMemberAuth);
	}

	@Override
	public List<ShopMemberAuth> selectAuthList(ShopMemberAuth shopMemberAuth) {
		return shopMemberAuthMapper.selectAuthList(shopMemberAuth);
	}

}
